using Digitalmes.Domain.Entities.Mes.Processes;

namespace Digitalmes.Application.Mes.Processes.StepStandards.Commands;

/// <summary>
/// 工艺标准删除命令。
/// </summary>
public sealed record DeleteStepStandardCommand(long StepStandardId) : IRequest<IResult<bool>>;

internal sealed class DeleteStepStandardCommandHandler(IRepository<ProcStepStandard> repo) : IRequestHandler<DeleteStepStandardCommand, IResult<bool>>
{
    public async Task<IResult<bool>> Handle(DeleteStepStandardCommand request, CancellationToken cancellationToken)
    {
        var ok = await repo.DeleteByIdAsync(request.StepStandardId, cancellationToken);
        return Result.From(ok);
    }
}
